package com.ruoyi.order.service;

import com.ruoyi.order.domain.Orders;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderProducer {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendOrder(Orders order) {
        rabbitTemplate.convertAndSend("fex1", "", order);
    }

    public void sendOrderToDlx(Orders order) {
        // 通过死信交换机发送消息
        rabbitTemplate.convertAndSend("fex2", "", order);
    }
}
